package me.zk.practice1.hw;

import java.util.Arrays;
import java.util.Scanner;

public class HWBJJ16 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        int[] nums = Arrays.stream(scanner.nextLine().split(" ")).mapToInt(Integer::parseInt).toArray();

        int[] n1 = new int[nums.length-1];
        System.arraycopy(nums,0,n1,0,n1.length );
        int[] n2 = new int[nums.length-1];
        System.arraycopy(nums,1,n2,0,n1.length );
        int max = Math.max(get(n1),get(n2));
        System.out.println(max);
    }

    public static int get(int[] nums) {

        int[] dp = new int[nums.length+1];
        dp[0] = 0;
        dp[1] = nums[0];
        for (int i = 2; i <= nums.length; i++) {
            dp[i] = Math.max(dp[i-1],dp[i-2]+nums[i-1]);
        }
        return dp[nums.length];
    }
}
